package com.DButils;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.mysql.cj.x.protobuf.MysqlxPrepare;

import javax.sql.DataSource;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

public class DBUtils {
    Connection conn;
    PreparedStatement ps;
    public ResultSet select(String sql ){
        return null;
    }
    public int update(String sql ){
        return -1;
    }
    private void getConn(){
        try {
            Properties properties = new Properties();
            properties.load(new FileInputStream("JDBC/JDBC9.28/io/druid.properties"));
            DataSource ds = DruidDataSourceFactory.createDataSource(properties);
            conn = ds.getConnection();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void getPrepare(String sql){
        try {
            ps = conn.prepareStatement(sql);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    public void close(){

    }
}
